#include "modules/AssistModule/TimeModule.h"
#include "events/SystemEvt.h"
#include "modules/AssistModule/LogModule.h"

namespace behavior_controller
{
void TimeModule::InstallFunctors()
{
    ptr_100hz = std::make_shared<Frequency<time::SteadyClock>>(std::bind(&TimeModule::Timer100HzCallBack, this));
    ptr_100hz->SetFrequency(100);
    ptr_100hz->Start();

    ptr_2hz = std::make_shared<Frequency<time::SteadyClock>>(std::bind(&TimeModule::Timer2HzCallBack, this));
    ptr_2hz->SetFrequency(2);
    ptr_2hz->Start();
}

void TimeModule::Timer100HzCallBack()
{
    evt::Timer100Hz::Send();
}

void TimeModule::Timer2HzCallBack()
{
    evt::Timer2Hz::Send();
}

void TimeModule::PrepareRemove()
{
    ptr_100hz->Stop();
    ptr_2hz->Stop();
    ClonerBase::PrepareRemove();
}
} // namespace behavior_controller